package emby.util;

public class Print {

	static int tabcount = 0;
	public static void tab(){
		tabcount ++;
	}
	public static void untab(){
		tabcount --;
		if( tabcount <0){
			tabcount = 0;
		}
	}

	public static void println(){
		System.out.println();
	}
	public static void println(Object...o){
		print(o);
		System.out.println();
	}

	public static void print(Object... o){
		if( o==null) return;
		//print tabs
		for(int i = 0; i<tabcount; i++){
			System.out.print("\t");
		}
		for(int i = 0; i<o.length;i++){
			if( o[i] instanceof Object[]){
				printArr((Object[])o[i]);
			}
			else
				System.out.print(o[i].toString());
		}
	}

	public static void printArr(Object[] o){
		if( o==null || o.length<1) return;
		System.out.print("{");
		for(int i = 0; i<o.length-1;i++){
				System.out.print(o[i].toString()+", ");
		}
		System.out.print(o[o.length-1].toString()+"}");
	}

	private static boolean isArray(Object o){
		try{
			Object obj = ((Object[])o)[0];
			return true;
		}catch(Exception e){
			return false;
		}

	}
}
